<template>
  <!-- 商品库存列表 -->
  <div class="app-container">
    <el-form :model="queryParams" :inline="true" label-width="70px">
      <el-form-item label="商品名称">
        <el-input
          v-model="queryParams.goodsName"
          placeholder="请输入商品名称"
          size="small"
          style="width: 180px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <!-- <el-form-item label="备注">
        <el-input
          v-model="queryParams.remarks"
          placeholder="请输入备注信息"
          size="small"
          style="width: 160px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <!-- <el-button
        type="primary"
        plain
        icon="el-icon-plus"
        size="mini"
        @click="handleAddOrder"
        >新增</el-button
      >
      <el-button
        type="danger"
        plain
        icon="el-icon-refresh"
        size="mini"
        @click="handleClearCache"
        >刷新</el-button
      > -->
    </el-row>
    <el-table v-loading="loading" :data="typeList">
      <el-table-column
        label="序号"
        align="center"
        type="index"
        :show-overflow-tooltip="true"
        prop=""
      >
      </el-table-column>
      <el-table-column label="商品名称" align="center" prop="goodsName" />
      <el-table-column
        label="采购价格"
        align="center"
        :show-overflow-tooltip="true"
        prop="procurePricing"
      >
      </el-table-column>
      <!-- <el-table-column label="客户类型" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.customerType == 1 ? "启用" : "停用" }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="公司库存" align="center" prop="stockCompany">
      </el-table-column>
      <el-table-column label="工厂库存" align="center" prop="stockFactory">
      </el-table-column>
      <!-- <el-table-column
        label="采购人"
        align="center"
        prop="procurer"
        width="180"
      >
      </el-table-column> -->
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        width="180"
      >
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remarks" width="180">
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { goodsStockList } from "@/api/goods/index";
export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      total: 0,
      // 订单列表
      typeList: [],
      // 是否显示弹出层
      open: false,
      // 搜索状态字典
      statusOptions: [], //支付类型
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        stockId: null,
        goodsName: null,
        remarks: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleClearCache() {
      window.location.reload();
    },
    handleAddOrder() {
      //新增库存
      this.$router.push({ path: "/commodity/goodsStockAdd" });
    },
    /** 查询字典类型列表 */
    getList(index) {
      this.loading = true;
      goodsStockList(this.queryParams).then((response) => {
        this.typeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    resetQuery() {
      //重置事件
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        stockId: null,
        goodsName: null,
        remarks: null,
      };
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
.el-range-editor {
  width: 100% !important;
}

.app-container {
  .dialog-footer {
    display: flex;
    justify-content: flex-end;
  }
  .el-col-11 {
    width: 100%;
  }
  .el-form-item__content {
    position: relative !important;
    span {
      font-size: 16px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #333333;
      position: absolute;
      top: 1px;
      right: 12px;
    }
  }
  .mb8 {
    .title {
      font-size: 20px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #333333;
    }
    .create {
      margin-right: 20 px;
      float: right;
    }
  }
}
</style>